package com.itheima.text4;

import java.util.concurrent.ArrayBlockingQueue;

public class Customer extends Thread {

    private ArrayBlockingQueue<String> queue;

    public Customer(ArrayBlockingQueue<String> queue) {
        this.queue = queue;
    }

    @Override
    public void run() {
        while (true) {
            try {
                Thread.sleep(100);
                String s = queue.take();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("用户拿了一瓶奶");
        }
    }
}
